const MySQL = require('mysql');
const config = require('./baseConfig')
const db = MySQL.createPool(config.db);

module.exports = function query(sql,values){
return new Promise((resolve, reject) => {
    db.getConnection((err,connection)=>{
        if (err) {
            reject(err)
        }else{
            connection.query(sql,values,(err,row)=>{
                if (err) {
                    reject(err)
                }else{
                    resolve(row)
                }
            })
            connection.release()
        }
    })
})
}

